package com.example.leetdemo.finash;

import java.util.Arrays;

public class Solution274 {

    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int max = 0;
        for (int i = 0; i < citations.length; i++) {
            if (citations[i] >= citations.length - i) {
                max = Math.max(max, citations.length - i);
            }
        }
        return max;
    }

}
